package cate.game.role.pvp.arena.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBArena;
import cate.game.role.fight.FuncPosition;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

import java.util.List;

@ClientMsg(title = "跨服擂台赛-设置防守阵容 请求")
public class ArenaUpdateDefendPosition implements MsgInput {
    @NoteField("阵容视野")
    public List<Boolean> defendVisions;
    @NoteField("布阵")
    public FuncPosition funcPosition;

    @Override
    public MsgConfig conf() {
        return MsgIdBArena.UPDATE_DEFEND_POSITION;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = cc.getRole().getPvp().arena.updateDefendPosition(defendVisions, funcPosition);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        } else {
            cc.getRole().getPvp().arena.noticeUpdate();
        }
    }
}
